{% extends "base/base_layout.html" %}
{% load static %}
{% block sidebar_option %}
    sidebar-mini
{% endblock %}
{% block extra_css %}
    <!-- DataTables -->
    <link rel="stylesheet" href="{% static "adminlte/plugins/datatables-bs4/dataTables.bootstrap4.min.css" %}">
    <link rel="stylesheet" href="{% static "others/css/spinner.css" %}">
    <style type="text/css" media="print">
        @page {
            size: landscape;
        }

        @media print {
            .btn, #scan_options {
                display: none;
            }
        }
    </style>
    <style>
        #app_icon {
            width: 64px;
            height: 64px;
        }

        #pre-wrap {
            white-space: pre-wrap; /* css-3 */
            white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
            white-space: -pre-wrap; /* Opera 4-6 */
            white-space: -o-pre-wrap; /* Opera 7 */
            word-wrap: break-word; /* Internet Explorer 5.5+ */
        }
    </style>
    <script>
        // Preloading
        function dynamic_loader() {
            var loadingOverlay = document.querySelector('.loading');
            loadingOverlay.classList.remove('hidden');
        }
    </script>
{% endblock %}
{% block sidebar %}
    <!--Loader-->
    <div class="hidden loading">
        <div class='uil-ring-css' style='transform:scale(0.79);'>
            <div></div>
        </div>
    </div>
    <!-- Main Sidebar Container -->
    <!-- Sidebar -->
    <div class="sidebar">
        <!-- Sidebar user panel (optional) -->
        <div class="user-panel mt-3 pb-3 mb-3 d-flex">
            <div class="info">
                <a href="#" class="d-block">静态扫描</a>
            </div>
        </div>

        <!-- Sidebar Menu -->
        <nav class="mt-2">
            <ul class="nav nav-pills nav-sidebar flex-column nav-child-indent" data-widget="treeview" role="menu"
                data-accordion="false">

                <li class="nav-item">
                    <a href="#information" class="nav-link">
                        <i class="nav-icon fas fa-info-circle"></i>
                        <p>
                            信息
                        </p>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#scan_options" class="nav-link">
                        <i class="nav-icon fas fa-cog"></i>
                        <p>
                            扫描选项
                        </p>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#certificate" class="nav-link">
                        <i class="nav-icon fas fa-certificate"></i>
                        <p>
                            签名证书
                        </p>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#permissions" class="nav-link">
                        <i class="nav-icon fas fa-list"></i>
                        <p>
                            权限
                        </p>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#android_api" class="nav-link">
                        <i class="nav-icon fab fa-android"></i>
                        <p>
                            Android API
                        </p>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#browsable" class="nav-link">
                        <i class="nav-icon fas fa-clone"></i>
                        <p>
                            可浏览的 Activities
                        </p>
                    </a>
                </li>

                <li class="nav-item has-treeview">
                    <a href="#" class="nav-link">
                        <i class="nav-icon fas fa-shield-alt"></i>
                        <p>
                            安全分析
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="#network_security" class="nav-link">
                                <i class="nav-icon fas fa-lock"></i>
                                <p>
                                    网络安全
                                </p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#manifest" class="nav-link">
                                <i class="fas fa-search nav-icon"></i>
                                <p>Manifest扫描</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#code_analysis" class="nav-link">
                                <i class="fa fa-code nav-icon"></i>
                                <p>代码扫描</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#binary_analysis" class="nav-link">
                                <i class="nav-icon fas fa-flag"></i>
                                <p>二进制文件扫描</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#niap_analysis" class="nav-link">
                                <i class="fa fa-id-badge nav-icon"></i>
                                <p> NIAP Analysis</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#file_analysis" class="nav-link">
                                <i class="fa fa-file nav-icon"></i>
                                <p>文件扫描</p>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="nav-item has-treeview">
                    <a href="#" class="nav-link">
                        <i class="nav-icon fa fa-bug"></i>
                        <p>
                            恶意扫描
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="#apkid" class="nav-link">
                                <i class="fas fa-fingerprint nav-icon"></i>
                                <p>APKiD Analysis</p>
                            </a>
                        </li>
                        {% if virus_total %}
                            <li class="nav-item">
                                <a href="#virus_total" class="nav-link">
                                    <i class="fas fa-spider nav-icon"></i>
                                    <p>病毒总数</p>
                                </a>
                            </li>
                        {% endif %}
                        <li class="nav-item">
                            <a href="#serverlocations" class="nav-link">
                                <i class="fas fa-globe-asia nav-icon"></i>
                                <p>服务定位</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#malware_check" class="nav-link">
                                <i class="fab fa-searchengin nav-icon"></i>
                                <p>域恶意软件检查</p>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="nav-item has-treeview">
                    <a href="#" class="nav-link">
                        <i class="nav-icon fa fa-plus"></i>
                        <p>
                            认出
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="#urls" class="nav-link">
                                <i class="fas fa-globe nav-icon"></i>
                                <p>url地址</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#firebase" class="nav-link">
                                <i class="fas fa-database nav-icon"></i>
                                <p>DB</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#emails" class="nav-link">
                                <i class="fas fa-envelope nav-icon"></i>
                                <p>邮件</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#trackers" class="nav-link">
                                <i class="fas fa-user-secret nav-icon"></i>
                                <p>追踪</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#strings" class="nav-link">
                                <i class="fas fa-font nav-icon"></i>
                                <p>字符串</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#secrets" class="nav-link">
                                <i class="fas fa-key nav-icon"></i>
                                <p>硬编码密码</p>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="nav-item has-treeview">
                    <a href="#" class="nav-link">
                        <i class="nav-icon fas fa-th-large"></i>
                        <p>
                            组件
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="#activities" class="nav-link">
                                <i class="fa fa-language nav-icon"></i>
                                <p>Activities</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#services" class="nav-link">
                                <i class="fa fa-cogs nav-icon"></i>
                                <p>Services</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#receivers" class="nav-link">
                                <i class="fa fa-assistive-listening-systems nav-icon"></i>
                                <p>Receivers</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#providers" class="nav-link">
                                <i class="fa fa-database nav-icon"></i>
                                <p>Providers</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#libraries" class="nav-link">
                                <i class="fab fa-buffer nav-icon"></i>
                                <p>Libraries</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="#files" class="nav-link">
                                <i class="far fa-copy nav-icon"></i>
                                <p>Files</p>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="nav-item">
                    <a href="../pdf/?md5={{ md5 }}" class="nav-link">
                        <i class="nav-icon fas fa-file-pdf"></i>
                        <p>
                            PDF报告
                        </p>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="javascript:window.print()" class="nav-link">
                        <i class="nav-icon fa fa-print"></i>
                        <p>
                            打印报告
                        </p>
                    </a>
                </li>
                {% if dynamic_analysis_done %}
                    <li class="nav-item">
                        <a href="../dynamic_report/{{ md5 }}" class="nav-link">
                            <i class="nav-icon fas fa-file-alt"></i>
                            <p>
                                动态扫描报告
                            </p>
                        </a>
                    </li>
                {% else %}
                    <li class="nav-item">
                        <a onclick="dynamic_loader()" href="../android_dynamic/{{ md5 }}" class="nav-link">
                            <i class="nav-icon fa fa-play-circle"></i>
                            <p>
                                开始动态扫描
                            </p>
                        </a>
                    </li>
                {% endif %}
            </ul>
        </nav>
        <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
{% endblock %}
{% block content %}
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <div class="content-header">
            <!--
              <div class="container-fluid">
                <div class="row mb-2">
                  <div id="mobsf_header" align="center">
                  </div>
                </div>
              </div>-->
        </div>
        <!-- /.content-header -->


        <!-- Main content -->
        <a id="information" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">

                        <div class="card">
                            <div class="card-body">
                                <h5 class="card-title"></h5>
                                <div class="row">
                                    <div class="col-2">
                                        <p><strong><i class="fas fa-check-double"></i> 应用得分</strong></p>
                                        <img id="app_icon"
                                             src="{% if icon_found %}/download/{{ md5 }}-icon.png{% else %}{% static 'img/no_icon.png' %}{% endif %}"/>
                                        {% if icon_hidden %}
                                            <strong>隐藏图标!</strong>
                                        {% endif %}
                                        <br/>
                                        <span class="badge bg-info">平均 CVSS</span>
                                        <strong>{{ average_cvss }} </strong><br/>
                                        <span class="badge bg-{% if security_score < 50 %}danger{% elif security_score == 100 %}success{% else %}warning{% endif %}">安全分</span>
                                        <strong>{{ security_score }}/100 </strong><br/>
                                        {% if trackers.detected_trackers > 0 %}
                                            <span class="badge bg-warning">跟踪器</span>
                                            <strong>{{ trackers.detected_trackers }}/{{ trackers.total_trackers }}</strong>
                                            <br/>
                                        {% else %}
                                            <span class="badge bg-success">跟踪器</span>
                                            <strong>{{ trackers.detected_trackers }}/{{ trackers.total_trackers }}</strong>
                                            <br/>
                                        {% endif %}
                                        {% if virus_total and virus_total.items|length > 9 %}
                                            {% if virus_total.positives > 0 %}
                                                <span class="badge bg-danger">VirusTotal 检测</span>
                                                <strong>{{ virus_total.positives }}/{{ virus_total.total }}</strong>
                                                <br/>
                                            {% else %}
                                                <span class="badge bg-success">VirusTotal 检测</span>
                                                <strong>{{ virus_total.positives }}/{{ virus_total.total }}</strong>
                                                <br/>
                                            {% endif %}
                                        {% endif %}
                                    </div>
                                    <div class="col-6">
                                        <p><strong><i class="fas fa-box-open"></i> 档案资料 </strong></p>
                                        <span class="badge bg-primary">文件名</span>
                                        {{ file_name }}<br/>
                                        <span class="badge bg-primary">大小</span>
                                        {{ size }}<br/>
                                        <span class="badge bg-primary">MD5</span>
                                        {{ md5 }}<br/>
                                        <span class="badge bg-primary">SHA1</span>
                                        {{ sha1 }}<br/>
                                        <span class="badge bg-primary">SHA256</span>
                                        {{ sha256 }}<br/>
                                    </div>
                                    <div class="col-4">
                                        <p><strong><i class="fas fa-info"></i> 应用信息 </strong></p>
                                        <span class="badge bg-primary">app名称</span>
                                        {{ app_name }}<br/>
                                        <span class="badge bg-primary">包名</span>
                                        {{ package_name }}<br/>
                                        <span class="badge bg-primary">主Activity</span>
                                        {{ main_activity }}<br/>
                                        <span class="badge bg-primary">Target SDK</span>
                                        {{ target_sdk }}
                                        <span class="badge bg-primary">最小SDK</span>
                                        {{ min_sdk }}
                                        <span class="badge bg-primary">最大SDK</span>
                                        {{ max_sdk }}<br/>
                                        <span class="badge bg-primary">版本</span>
                                        {{ version_name }}
                                        <span class="badge bg-primary">安卓版本代码</span>
                                        {{ version_code }}
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <!-- Play Store -->
                    {% if not playstore_details.error %}
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-body">
                                    <p>
                                        <strong><i class="fab fa-google-play"></i> 游戏商店信息</strong>
                                    </p>
                                    <span class="badge bg-info">标题</span>
                                    {{ playstore_details.title }} <br/>
                                    <span class="badge bg-info">分数</span>
                                    {{ playstore_details.score }}
                                    <span class="badge bg-info">安装</span>
                                    {{ playstore_details.installs }}
                                    <span class="badge bg-info">Price</span>
                                    {{ playstore_details.price }}
                                    <span class="badge bg-info">安卓版本支持</span>
                                    {{ playstore_details.androidVersionText }}
                                    <span class="badge bg-info">类别</span>
                                    {{ playstore_details.genre }}
                                    <span class="badge bg-info">应用市场</span>
                                    <a target="_blank" href="{{ playstore_details.url }}"
                                       rel="noopener noreferrer"> {{ package_name }} </a>
                                    <br/>
                                    <span class="badge bg-info">开发者</span>
                                    {{ playstore_details.developer }},
                                    <span class="badge bg-info">开发者 ID</span>
                                    {{ playstore_details.developerId }} <br/>
                                    <span class="badge bg-info">开发者 Address</span>
                                    {{ playstore_details.developerAddress }} <br/>
                                    <span class="badge bg-info">开发者 Website</span>
                                    {{ playstore_details.developerWebsite }} <br/>
                                    <span class="badge bg-info">开发者 Email</span>
                                    {{ playstore_details.developerEmail }}
                                    <br/>
                                    <span class="badge bg-info">发布日期</span>
                                    {{ playstore_details.released }}
                                    <span class="badge bg-info">隐私政策</span>
                                    <a target="_blank" href="{{ playstore_details.privacyPolicy }}"
                                       rel="noopener noreferrer">隐私链接</a>
                                    <br/>
                                    <span class="badge bg-info">描述</span>
                                    <pre id="pre-wrap">{{ playstore_details.description }}</pre>
                                </div>
                            </div><!-- /.card -->
                        </div>
                    {% endif %}
                    <!-- /.col -->
                    <!-- row and container-->
                </div>
            </div>

            <!-- Boxes -->
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">

                        <div class="card">
                            <div class="card-body">
                                <h5 class="card-title"></h5>
                                <div class="row">
                                    <!-- Boxes columns -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <!-- small box -->
                                        <div class="small-box bg-info">
                                            <div class="inner">
                                                <h3>{{ activities | length }}</h3>

                                                <p>ACTIVITIES</p>
                                            </div>
                                            <div class="icon">
                                                <i class="fa fa-language"></i>
                                            </div>
                                            <a href="#activities" class="small-box-footer">查看 <i
                                                    class="fas fa-arrow-circle-down"></i></a>
                                        </div>
                                    </div>
                                    <!-- ./col -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <!-- small box -->
                                        <div class="small-box bg-success">
                                            <div class="inner">
                                                <h3>{{ services | length }}</h3>

                                                <p>SERVICES</p>
                                            </div>
                                            <div class="icon">
                                                <i class="fa fa-cogs"></i>
                                            </div>
                                            <a href="#services" class="small-box-footer">查看 <i
                                                    class="fas fa-arrow-circle-down"></i></a>
                                        </div>
                                    </div>
                                    <!-- ./col -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <!-- small box -->
                                        <div class="small-box bg-warning">
                                            <div class="inner">
                                                <h3>{{ receivers | length }}</h3>

                                                <p>RECEIVERS</p>
                                            </div>
                                            <div class="icon">
                                                <i class="fa fa-assistive-listening-systems"></i>
                                            </div>
                                            <a href="#receivers" class="small-box-footer">查看 <i
                                                    class="fas fa-arrow-circle-down"></i></a>
                                        </div>
                                    </div>
                                    <!-- ./col -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <!-- small box -->
                                        <div class="small-box bg-danger">
                                            <div class="inner">
                                                <h3>{{ providers | length }}</h3>

                                                <p>PROVIDERS</p>
                                            </div>
                                            <div class="icon">
                                                <i class="fa fa-database"></i>
                                            </div>
                                            <a href="#providers" class="small-box-footer">查看 <i
                                                    class="fas fa-arrow-circle-down"></i></a>
                                        </div>
                                        <!-- /.row -->
                                    </div><!-- /.container-fluid -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <div class="info-box">
                                            <span class="info-box-icon bg-info elevation-1"><i
                                                    class="fas fa-language"></i></span>

                                            <div class="info-box-content">
                                                <span class="info-box-text">导出 <br/>Activities</span>
                                                <span class="info-box-number">
                              {{ exported_count.exported_activities }}
                            </span>
                                            </div>
                                            <!-- /.info-box-content -->
                                        </div>
                                        <!-- /.info-box -->
                                    </div>
                                    <!-- /.col -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <div class="info-box mb-3">
                                            <span class="info-box-icon bg-success elevation-1"><i
                                                    class="fas fa-cogs"></i></span>

                                            <div class="info-box-content">
                                                <span class="info-box-text">导出 <br/>Services</span>
                                                <span class="info-box-number">{{ exported_count.exported_services }}</span>
                                            </div>
                                            <!-- /.info-box-content -->
                                        </div>
                                        <!-- /.info-box -->
                                    </div>
                                    <!-- /.col -->

                                    <!-- fix for small devices only -->
                                    <div class="clearfix hidden-md-up"></div>

                                    <div class="col-12 col-sm-6 col-md-3">
                                        <div class="info-box mb-3">
                                            <span class="info-box-icon bg-warning elevation-1"><i
                                                    class="fas fa-assistive-listening-systems"></i></span>

                                            <div class="info-box-content">
                                                <span class="info-box-text">导出 <br/>Receivers</span>
                                                <span class="info-box-number">{{ exported_count.exported_receivers }}</span>
                                            </div>
                                            <!-- /.info-box-content -->
                                        </div>
                                        <!-- /.info-box -->
                                    </div>
                                    <!-- /.col -->
                                    <div class="col-12 col-sm-6 col-md-3">
                                        <div class="info-box mb-3">
                                            <span class="info-box-icon bg-danger elevation-1"><i
                                                    class="fas fa-database"></i></span>

                                            <div class="info-box-content">
                                                <span class="info-box-text">导出 <br/>Providers</span>
                                                <span class="info-box-number">{{ exported_count.exported_providers }}</span>
                                            </div>
                                            <!-- /.info-box-content -->
                                        </div>
                                        <!-- /.info-box -->
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </section>
        <!-- =========================end information==================================== -->


        <a id="scan_options" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-4">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-cog"></i>扫描选项</strong>
                                </p>
                                <p>
                                    <a href="../static_analyzer/?checksum={{ md5 }}&amp;name={{ file_name }}&amp;type=apk&amp;rescan=1"
                                       class="btn btn-info" role="button"><i class="fa fa-sync"></i> 重新扫描</a></p>
                                <p>
                                    <a onclick="dynamic_loader()" href="../android_dynamic/{{ md5 }}"
                                       class="btn btn-success" role="button"><i class="fa fa-play-circle"></i>
                                        启动动态扫描
                                    </a>
                                </p>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <div class="col-lg-8">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-file-code"></i>反编译代码</strong>
                                </p>
                                <p>
                                    <a target="_blank"
                                       href="../manifest_view/?md5={{ md5 }}&amp;type={{ app_type }}&amp;bin=1"
                                       role="button" class="btn btn-primary"><i class="fa fa-eye"></i> 查看
                                        AndroidManifest.xml</a>
                                    <a href="{% url "tree_view" %}?md5={{ md5 }}&amp;type=java" class="btn btn-info"
                                       role="button"><i class="fa fa-code"></i> 查看Source</a>
                                    <a href="{% url "tree_view" %}?md5={{ md5 }}&amp;type=smali" class="btn btn-info"
                                       role="button"><i class="fa fa-code"></i> View Smali</a>
                                </p>
                                <p>
                                    <a href="../generate_downloads/?hash={{ md5 }}&amp;file_type=java"
                                       class="btn btn-warning" role="button"> <i class="fa fa-download"></i> 下载java代码
                                       </a>
                                    <a href="../generate_downloads/?hash={{ md5 }}&amp;file_type=smali"
                                       class="btn btn-warning"> <i class="fa fa-download"></i> 下载 Smali 代码</a>
                                    <a href="../generate_downloads/?hash={{ md5 }}&amp;file_type=apk"
                                       class="btn btn-warning"> <i class="fa fa-download"></i> 下载apk</a>
                                </p>
                            </div>
                        </div>
                    </div>

                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end scan options================================== -->
        <a id="certificate" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-certificate"></i> 签名证书</strong>
                                </p>
                                {% if certificate_analysis %}
                                    <pre><code>{{ certificate_analysis.certificate_info }}</code></pre>
                                    <!--Cert status-->
                                    <div class="table-responsive">
                                        <table id="table_cert" class="table table-bordered table-hover table-striped">
                                            <thead>
                                            <tr>
                                                <th>状态</th>
                                                <th>描述</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {% for find in certificate_analysis.certificate_findings %}
                                                <tr>
                                                    <td>
                                                        {% if find.0 == 'bad' %}
                                                            <span class="badge bg-danger">不良</span>
                                                        {% elif find.0  == 'good' %}
                                                            <span class="badge bg-success">安全</span>
                                                        {% elif find.0  == 'warning' %}
                                                            <span class="badge bg-warning">警告</span>
                                                        {% endif %}
                                                    </td>
                                                    <td>{{ find.1 }}</td>
                                                </tr>
                                            {% endfor %}
                                            </tbody>
                                        </table>
                                    </div>
                                {% else %}
                                    无法读取代码签名证书.
                                {% endif %}
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>

        </section>
        <!-- ===========================end cert ================================== -->
        <a id="permissions" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-list"></i> 申请权限</strong>
                                <p>
                                <div class="table-responsive">
                                    <table id="table_permissions"
                                           class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>权限</th>
                                            <th>状态</th>
                                            <th>信息</th>
                                            <th>描述</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for perm,desc in permissions.items %}
                                            <tr>
                                                <td>{{ perm }}</td>
                                                <td>
                                                    {% if desc.status == 'dangerous' %}
                                                        <span class="badge bg-danger">危险</span>
                                                    {% elif desc.status == 'normal' %}
                                                        <span class="badge bg-info">普通</span>
                                                    {% elif desc.status == 'signatureOrSystem' %}
                                                        <span class="badge bg-warning">签名或系统</span>
                                                    {% elif desc.status == 'signature' %}
                                                        <span class="badge bg-success">签名</span>
                                                    {% elif desc.status == 'unknown' %}
                                                        <span class="badge bg-secondary">未知</span>
                                                    {% endif %}
                                                </td>
                                                <td>{{ desc.info }}</td>
                                                <td>{{ desc.description }}</td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>

                                </div>

                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end permission ================================== -->
        <a id="android_api" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fab fa-android"></i> ANDROID API</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_so" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>api</th>
                                            <th>FILES</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for rule, details in android_api.items %}
                                            <tr>
                                                <td>
                                                    {{ details.metadata.description }}
                                                </td>
                                                <td>
                                                    {% for file_path, lines in details.files.items %}
                                                        <a href="{% url "view_source" %}?file={{ file_path }}&amp;md5={{ md5 }}&amp;type={{ app_type }}&amp;lines={{ lines }}"> {{ file_path }}</a>
                                                        <br/>
                                                    {% endfor %}
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end api analysis ================================== -->
        <a id="browsable" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-clone"></i> 浏览 ACTIVITIES</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_browsable" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>ACTIVITY</th>
                                            <th>INTENT</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for activity,intent_details in browsable_activities.items %}
                                            <tr>
                                            <td>{{ activity }}</td>
                                            <td>
                                            {% if intent_details|key:"schemes" %}
                                                <strong>方案</strong>:
                                                {% for scheme in intent_details|key:"schemes" %}
                                                    {{ scheme }},
                                                {% endfor %}
                                                <br/>
                                            {% endif %}
                                            {% if intent_details|key:"hosts" %}
                                                <strong>Hosts:</strong> {% for host in intent_details|key:"hosts" %}
                                                {{ host }},
                                            {% endfor %}
                                                <br/>
                                            {% endif %}
                                            {% if intent_details|key:"ports" %}
                                                <strong>Ports:</strong> {% for port in intent_details|key:"ports" %}
                                                {{ port }},
                                            {% endfor %}
                                                <br/>
                                            {% endif %}
                                            {% if intent_details|key:"mime_types" %}
                                                <strong>Mime Types:</strong>
                                                {% for mime in intent_details|key:"mime_types" %}
                                                    {{ mime }},
                                                {% endfor %}
                                                <br/>
                                            {% endif %}
                                            {% if intent_details|key:"paths" %}
                                                <strong>Paths:</strong> {% for path in intent_details|key:"paths" %}
                                                {{ path }},
                                            {% endfor %}
                                                <br/>
                                            {% endif %}
                                            {% if intent_details|key:"path_prefixs" %}
                                                <strong>Path Prefixes:</strong>
                                                {% for prefix in intent_details|key:"path_prefixs" %}
                                                    {{ prefix }},
                                                {% endfor %}
                                                <br/>
                                            {% endif %}
                                            {% if intent_details|key:"path_patterns" %}
                                                <strong>Path Patterns:</strong>
                                                {% for pattern in intent_details|key:"path_patterns" %}
                                                    {{ pattern }},
                                                {% endfor %}
                                                <br/>
                                            {% endif %}
                                        {% endfor %}
                                        </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end browsable activities ================================== -->
        <a id="network_security" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-lock"></i> 网络扫描</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_manifest" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>序列号</th>
                                            <th>范围</th>
                                            <th>严重性</th>
                                            <th>描述</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for item in network_security %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>
                                                    {% for url in item.scope %}
                                                        {{ url }}</br>
                                                    {% endfor %}
                                                </td>
                                                <td>
                                                    {% if item.severity == "high" %}
                                                        <span class="badge bg-danger">高</span>
                                                    {% elif item.severity == "good" %}
                                                        <span class="badge bg-success">好</span>
                                                    {% elif item.severity == "info" %}
                                                        <span class="badge bg-info">信息</span>
                                                    {% elif item.severity == "warning" %}
                                                        <span class="badge bg-warning">警告</span>
                                                    {% endif %}
                                                </td>
                                                <td>
                                                    {{ item.description }}
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end network security ================================== -->
        <a id="manifest" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-search"></i> MANIFEST扫描</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_manifest" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>ISSUE</th>
                                            <th>SEVERITY</th>
                                            <th>描述</th>
                                        </tr>
                                        </thead>
                                        <tbody>

                                        {% for item in manifest_analysis %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>
                                                    {{ item|key:"title" | safe }}
                                                </td>
                                                <td>

                                                    {% if item|key:"stat" == "high" %}
                                                        <span class="badge bg-danger">高</span>
                                                    {% elif item|key:"stat" == "info" %}
                                                        <span class="badge bg-info">信息</span>
                                                    {% elif item|key:"stat" == "medium" %}
                                                        <span class="badge bg-warning">中</span>
                                                    {% endif %}

                                                </td>
                                                <td>
                                                    {{ item|key:"desc" }}
                                                </td>

                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end manifest analysis ================================== -->
        <a id="code_analysis" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-code"></i> 代码扫描</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_code" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>序列号</th>
                                            <th>问题</th>
                                            <th>严重性</th>
                                            <th>标准</th>
                                            <th>文件</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for rule, details in code_analysis.items %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>
                                                    {% if details.metadata|key:"ref" %}
                                                        <a href="{{ details.metadata.ref }}" target="_blank"
                                                           rel="noopener"> {{ details.metadata.description }}</a>
                                                    {% else %}
                                                        {{ details.metadata.description }}
                                                    {% endif %}
                                                </td>
                                                <td>
                                                    {% if details.metadata.severity == "high" %}
                                                        <span class="badge bg-danger">高</span>
                                                    {% elif details.metadata.severity == "good" %}
                                                        <span class="badge bg-success">安全</span>
                                                    {% elif details.metadata.severity == "warning" %}
                                                        <span class="badge bg-warning">警告</span>
                                                    {% elif details.metadata.severity == "info" %}
                                                        <span class="badge bg-info">信息</span>
                                                    {% endif %}
                                                </td>
                                                <td>
                                                    <strong>CVSS V2:</strong>
                                                    {{ details.metadata.cvss }}
                                                    {% if details.metadata.cvss > 6 %}
                                                        (high)
                                                    {% elif details.metadata.cvss == 0 %}
                                                        (info)
                                                    {% elif details.metadata.cvss >= 4 %}
                                                        (medium)
                                                    {% elif details.metadata.cvss < 4 %}
                                                        (low)
                                                    {% endif %}
                                                    {% if details.metadata.cwe %}</br> <strong>CWE: </strong>
                                                        {{ details.metadata.cwe }}{% endif %}
                                                    {% if details.metadata|key:"owasp-mobile" %}</br>
                                                        <strong>OWASP Top 10: </strong>
                                                        {{ details.metadata|key:"owasp-mobile" }}{% endif %}
                                                    {% if details.metadata.masvs %}</br> <strong>OWASP MASVS: </strong>
                                                        {{ details.metadata.masvs }}{% endif %}
                                                </td>
                                                <td>
                                                    {% for file_path, lines in details.files.items %}
                                                        <a href="{% url "view_source" %}?file={{ file_path }}&amp;md5={{ md5 }}&amp;type={{ app_type }}&amp;lines={{ lines }}"> {{ file_path }}</a>
                                                        <br/>
                                                    {% endfor %}
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end code analysis ================================== -->
        <a id="binary_analysis" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-flag"></i> 共享库二进制分析</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_binary" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>编号</th>
                                            <th>共享对象</th>
                                            <th>NX</th>
                                            <th>堆栈 CANARY</th>
                                            <th>RELRO</th>
                                            <th>路径</th>
                                            <th>运行路径</th>
                                            <th>强化</th>
                                            <th>SYMBOLS STRIPPED</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% if not binary_analysis %}
                                            未找到共享对象.
                                        {% endif %}
                                        {% for so in binary_analysis %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>{{ so.name }}</td>
                                                <td><b>{{ so.nx.is_nx }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.nx.severity == 'high' %}danger{% elif so.nx.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.nx.severity }}</span>
                                                    <br/>{{ so.nx.description }}</td>
                                                <td><b>{{ so.stack_canary.has_canary }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.stack_canary.severity == 'high' %}danger{% elif so.stack_canary.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.stack_canary.severity }}</span>
                                                    <br/>{{ so.stack_canary.description }}</td>
                                                <td><b>{{ so.relocation_readonly.relro }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.relocation_readonly.severity == 'high' %}danger{% elif so.relocation_readonly.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.relocation_readonly.severity }}</span>
                                                    <br/>{{ so.relocation_readonly.description }}</td>
                                                <td><b>{{ so.rpath.rpath }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.rpath.severity == 'high' %}danger{% elif so.rpath.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.rpath.severity }}</span>
                                                    <br/>{{ so.rpath.description }}</td>
                                                <td><b>{{ so.runpath.runpath }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.runpath.severity == 'high' %}danger{% elif so.runpath.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.runpath.severity }}</span>
                                                    <br/>{{ so.runpath.description }}</td>
                                                <td><b>{{ so.fortify.is_fortified }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.fortify.severity == 'high' %}danger{% elif so.fortify.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.fortify.severity }}</span>
                                                    <br/>{{ so.fortify.description }}</td>
                                                <td><b>{{ so.symbol.is_stripped }}</b>
                                                    <br/>
                                                    <span class="badge bg-{% if so.symbol.severity == 'high' %}danger{% elif so.symbol.severity == 'warning' %}warning{% else %}info{% endif %}">{{ so.symbol.severity }}</span>
                                                    <br/>{{ so.symbol.description }}</td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>

                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end binary analysis ================================== -->
        <a id="niap_analysis" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-id-badge"></i> NIAP ANALYSIS v1.3</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_file" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>NO</th>
                                            <th>确认</th>
                                            <th>要求</th>
                                            <th>特征</th>
                                            <th>描述</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for iden, details in niap_analysis.items %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>
                                                    <span class="badge {% if 'does not' in details.choice %} bg-warning {% elif 'not in accordance' in details.choice %} bg-danger {% else %} bg-info {% endif %}"> {{ iden }}</span>
                                                </td>
                                                <td>
                                                    {{ details.class }}
                                                </td>
                                                <td>
                                                    {{ details.description }}
                                                </td>
                                                <td>
                                                    {{ details.choice }}
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end niap analysis ================================== -->
        <a id="file_analysis" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-file"></i> 文件扫描</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_file" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>序列号</th>
                                            <th>问题</th>
                                            <th>文件</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for item in file_analysis %}
                                            <tr>
                                                <td>{{ forloop.counter }}</td>
                                                <td>
                                                    {{ item|key:"finding" }}
                                                </td>
                                                <td>
                                                    {% for cert_f in item|key:"files" %}
                                                        {{ cert_f }}<br/>
                                                    {% endfor %}
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end file analysis ================================== -->
        <a id="apkid" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-fingerprint"></i> APKiD 扫描</strong>
                                </p>
                                <div class="table-responsive">
                                    <table id="table_apkid" class="table table-bordered table-hover table-striped">
                                        <thead>
                                        <tr>
                                            <th>DEX</th>
                                            <th>描述</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% if apkid %}
                                            {% for file, details in apkid.items %}
                                                <tr>
                                                    <td>
                                                        {{ file }}
                                                    </td>
                                                    <td>
                                                        <table class="table table-bordered table-hover table-striped">
                                                            <thead>
                                                            <tr>
                                                                <th>FINDINGS</th>
                                                                <th>DETAILS</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            {% for detail, idens in details.items %}
                                                                <tr>
                                                                    <td>
                                                                        {% if detail == "anti_vm" %}
                                                                            <span class="badge bg-warning">反虚拟机代码</span>
                                                                        {% elif detail == "anti_disassembly" %}
                                                                            <span class="badge bg-warning">Anti Disassembly Code</span>
                                                                        {% elif detail == "anti_debug" %}
                                                                            <span class="badge bg-warning">Anti Debug Code</span>
                                                                        {% elif detail == "compiler" %}
                                                                            <span class="badge bg-info">Compiler</span>
                                                                        {% elif detail == "abnormal" %}
                                                                            <span class="badge bg-warning">Abnormal Code</span>
                                                                        {% elif detail == "obfuscator" %}
                                                                            <span class="badge bg-warning">Obfuscator</span>
                                                                        {% elif detail == "protector" %}
                                                                            <span class="badge bg-info">Protector</span>
                                                                        {% elif detail == "packer" %}
                                                                            <span class="badge bg-danger">Packer Found</span>
                                                                        {% elif detail == "dropper" %}
                                                                            <span class="badge bg-danger">Dropper Found</span>
                                                                        {% elif detail == "manipulator" %}
                                                                            <span class="badge bg-warning">Manipulator Found</span>
                                                                        {% else %}
                                                                            <span class="badge bg-info">{{ detail }}</span>
                                                                        {% endif %}
                                                                    </td>
                                                                    <td> {% for idn in idens %} {{ idn }}
                                                                        <br/> {% endfor %}</td>
                                                                </tr>
                                                            {% endfor %}
                                                            </tbody>
                                                        </table>
                                                    </td>

                                                </tr>
                                            {% endfor %}
                                        {% else %}
                                            <p align="center"><strong>APKiD not enabled.</strong></p>
                                        {% endif %}
                                        </tbody>

                                    </table>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end apkid analysis ================================== -->
        {% if virus_total %}
            <a id="virus_total" class="anchor"></a>
            <section class="content">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-body">
                                    <p>
                                        <strong><i class="fas fa-spider"></i> 病毒扫描</strong>
                                    </p>
                                    <div class="table-responsive">
                                        {% if virus_total.items|length < 9 %}
                                            {% comment %} Basic check to determine if the response is a msg or a result {% endcomment %}
                                            <p align="left">&nbsp;&nbsp;<strong>{{ virus_total.verbose_msg }}</strong>
                                            </p>
                                        {% else %}
                                            <p align="left">&nbsp;&nbsp;<strong> {{ virus_total.positives }}
                                                / {{ virus_total.total }}&nbsp; AV 发现此文件恶意! </strong>
                                                &nbsp;&nbsp;<a href="{{ virus_total.permalink }}" target="_blank"
                                                               rel="noopener"><i class="fas fa-th-list"></i> 全部报告</a>
                                            </p>
                                            {% if virus_total.positives > 0 %}
                                                <table id="table_vt"
                                                       class="table table-bordered table-hover table-striped">
                                                    <thead>
                                                    <tr>
                                                        <th>AV</th>
                                                        <th>DETECTION</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    {% for av_name,av_result in virus_total.scans.items %}
                                                        {% if av_result.detected == True %}
                                                            <tr>
                                                                <td>
                                                                    {{ av_name }}
                                                                </td>
                                                                <td>
                                                                    <span class="badge bg-danger">{{ av_result.result }}</span>
                                                                </td>
                                                            </tr>
                                                        {% endif %}
                                                    {% endfor %}
                                                    </tbody>
                                                </table>
                                            {% endif %}{% comment %} if results.positive > 0 {% endcomment %}
                                        {% endif %}{% comment %} if this is the upload msg or a result {% endcomment %}
                                    </div>
                                </div>
                            </div><!-- /.card -->
                        </div>
                        <!-- end row -->
                    </div>
                </div>
            </section>
        {% endif %}
        <!-- ===========================end virus total ================================== -->
        <style>
            #chartdiv {
                width: 100%;
                height: 500px;
                overflow: hidden;
            }
        </style>
        <a id="serverlocations" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-globe-asia"></i> 服务器位置</strong>
                                </p>
                                <div class="table-responsive">
                                    <div id="chartdiv"></div>
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end server locations ================================== -->
        <a id="malware_check" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fab fa-searchengin"></i> 域恶意软件检查</strong>
                                </p>
                                <div class="table-responsive">
                                    {% if domains %}
                                        <table id="table_malware"
                                               class="table table-bordered table-hover table-striped">
                                            <thead>
                                            <tr>
                                                <th>域名</th>
                                                <th>状态</th>
                                                <th>位置</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {% for domain, details in domains.items %}
                                                <tr>
                                                    <td>{{ domain }}</td>
                                                    <td>

                                                        {% if details|key:"bad" == "yes" %}
                                                            <span class="badge bg-danger">malware</span><br/>
                                                            <pre>
                      <strong>URL: </strong>{{ details|key:"domain_or_url" }}
                      <strong>IP: </strong><span class="badge bg-danger">{{ details|key:"ip" }}</span>
                      <strong>Description: </strong>{{ details|key:"desc" }}
                      </pre>
                                                        {% else %}
                                                            <span class="badge bg-success">good</span><br/>
                                                        {% endif %}
                                                    </td>
                                                    <td>
                                                        {% if details|key:"geolocation" %}
                                                            <strong>IP: </strong>
                                                            {{ details|key:"geolocation"|key:"ip" }}  <br/>
                                                            <strong>Country: </strong>
                                                            {{ details|key:"geolocation"|key:"country_long" }} <br/>
                                                            <strong>Region: </strong>
                                                            {{ details|key:"geolocation"|key:"region" }} <br/>
                                                            <strong>City: </strong>
                                                            {{ details|key:"geolocation"|key:"city" }} <br/>
                                                            <strong>Latitude: </strong>
                                                            {{ details|key:"geolocation"|key:"latitude" }} <br/>
                                                            <strong>Longitude: </strong>
                                                            {{ details|key:"geolocation"|key:"longitude" }} <br/>
                                                            <strong>View:<a target="_blank"
                                                                            href="http://maps.google.com/maps?q={{ details|key:"geolocation"|key:"latitude" }},{{ details|key:"geolocation"|key:"longitude" }}">Google
                                                            Map</a>
                                                        {% else %}
                                                            No Geolocation information available.
                                                        {% endif %}
                                                    </td>
                                                </tr>
                                            {% endfor %}
                                            </tbody>
                                        </table>
                                    {% endif %}
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end domain malware check ================================== -->
        <a id="urls" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-globe"></i> 地址</strong>
                                </p>
                                <div class="table-responsive">
                                    {% if urls %}
                                        <table id="table_urls" class="table table-bordered table-hover table-striped">
                                            <thead>
                                            <tr>
                                                <th>地址</th>
                                                <th>文件</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {% for urldict in urls %}
                                                <tr>
                                                    <td>
                                                        {% for u in urldict|key:"urls" %}
                                                            {{ u }} <br/>
                                                        {% endfor %}
                                                    </td>

                                                    <td>
                                                        <a href="{% url "view_source" %}?file={{ urldict|key:"path" }}&amp;md5={{ md5 }}&amp;type={{ app_type }}">{{ urldict|key:"path" }}</a>
                                                    </td>
                                                </tr>
                                            {% endfor %}
                                            </tbody>
                                        </table>
                                    {% endif %}
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end urls ================================== -->
        <a id="firebase" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-database"></i> FIREBASE DATABASE</strong>
                                </p>
                                <div class="table-responsive">
                                    {% if firebase_urls %}
                                        <table id="table_firebase"
                                               class="table table-bordered table-hover table-striped">
                                            <thead>
                                            <tr>
                                                <th>FIREBASE URL</th>
                                                <th>细节</th>
                                            </tr>
                                            </thead>

                                            <tbody>
                                            {% for item in firebase_urls %}
                                                <tr>
                                                    <td>
                                                        {{ item.url }}
                                                    </td>
                                                    <td>
                                                        {% if item.open %}
                                                            <span class="badge bg-danger">insecure</span><br/>Firebase
                                                            Database is exposed publicly.
                                                        {% else %}
                                                            <span class="badge bg-primary">信息</span><br/>App talks toa
                                                            Firebase database.
                                                        {% endif %}
                                                    </td>
                                                </tr>
                                            {% endfor %}
                                            </tbody>
                                        </table>
                                    {% endif %}
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end firebase db ================================== -->
        <a id="emails" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-envelope"></i> 邮件</strong>
                                </p>
                                <div class="table-responsive">
                                    {% if emails %}
                                        <table id="table_emails" class="table table-bordered table-hover table-striped">
                                            <thead>
                                            <tr>
                                                <th>邮件</th>
                                                <th>文件</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {% for email_dict in emails %}
                                                <tr>
                                                    <td>
                                                        {% for e in email_dict|key:"emails" %}
                                                            {{ e }} <br/>
                                                        {% endfor %}
                                                    </td>
                                                    <td>
                                                        <a href="{% url "view_source" %}?file={{ email_dict|key:"path" }}&amp;md5={{ md5 }}&amp;type={{ app_type }}">{{ email_dict|key:"path" }}</a>
                                                    </td>
                                                </tr>
                                            {% endfor %}
                                            </tbody>
                                        </table>
                                    {% endif %}
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end emails ================================== -->
        <a id="trackers" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-user-secret"></i> 追踪器</strong>
                                </p>
                                <div class="table-responsive">
                                    {% if trackers %}
                                        <table id="table_trackers"
                                               class="table table-bordered table-hover table-striped">
                                            <thead>
                                            <tr>
                                                <th>追踪器名称</th>
                                                <th>类别</th>
                                                <th>地址</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {% for trk in trackers|key:"trackers" %}
                                                <tr>
                                                    <td>
                                                        {{ trk.name }}
                                                    </td>
                                                    <td>
                                                        {{ trk.categories }}
                                                    </td>
                                                    <td>
                                                        <a target="_blank" href="{{ trk.url }}"
                                                           rel="noopener noreferrer">{{ trk.url }}</a>
                                                    </td>
                                                </tr>
                                            {% endfor %}
                                            </tbody>
                                        </table>
                                    {% endif %}
                                </div>
                            </div>
                        </div><!-- /.card -->
                    </div>
                    <!-- end row -->
                </div>
            </div>
        </section>
        <!-- ===========================end trackers ================================== -->
        <a id="strings" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-font"></i> 字符串</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for val in strings %}
                                            {{ val }}<br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end strings ================================== -->
        <a id="secrets" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fas fa-key"></i>可能的硬编码秘密</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for val in secrets %}
                                            {{ val }}<br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end secrets ================================== -->

        <a id="activities" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-language"></i> ACTIVITIES</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for act in activities %}
                                            {{ act }} <br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end activities ================================== -->
        <a id="services" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-cogs"></i> SERVICES</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for srv in services %}
                                            {{ srv }} <br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end services ================================== -->
        <a id="receivers" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-assistive-listening-systems"></i> RECEIVERS</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for rcv in receivers %}
                                            {{ rcv }} <br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>

        </section>
        <!-- ===========================end receivers ================================== -->
        <a id="providers" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fa fa-database"></i> PROVIDERS</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for prv in providers %}
                                            {{ prv }} <br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end providers ================================== -->
        <a id="libraries" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="fab fa-buffer"></i> LIBRARIES</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for lib in libraries %}
                                            {{ lib }} <br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end libraries ================================== -->
        <a id="files" class="anchor"></a>
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">
                                <p>
                                    <strong><i class="far fa-copy"></i> FILES</strong>
                                </p>
                                <div class="list-group">
                                    <p>
                                        {% for file in files %}
                                            {{ file }} <br/>
                                        {% endfor %}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.card -->
                </div>
                <!-- end row -->
            </div>
        </section>
        <!-- ===========================end files ================================== -->
        <!-- end of contents -->
    </div>

{% endblock %}
<!--end new UI-->
{% block extra_scripts %}
    <!-- DataTables -->
    <script src="{% static "adminlte/plugins/datatables/jquery.dataTables.min.js" %}"></script>
    <script src="{% static "adminlte/plugins/datatables-bs4/dataTables.bootstrap4.min.js" %}"></script>
    <script src="{% static "amcharts/core.js" %}"></script>
    <script src="{% static "amcharts/maps.js" %}"></script>
    <script src="{% static "amcharts/worldLow.js" %}"></script>
    <script src="{% static "amcharts/animated.js" %}"></script>
    <script>
        $(function () {
            // Datatable
            $('table').DataTable({
                "paging": true,
                "lengthChange": false,
                "searching": true,
                "ordering": true,
                "info": true,
                "autoWidth": true,
                "responsive": true,
            });
        });
        // Navbar Active
        $(".nav-link").on("click", function () {
            $(".nav-link").removeClass("active");
            $(this).addClass("active");
        });
    </script>


    <script>
        // Themes begin
        am4core.useTheme(am4themes_animated);
        // Themes end

        // Create map instance
        var chart = am4core.create("chartdiv", am4maps.MapChart);

        // Set map definition
        chart.geodata = am4geodata_worldLow;

        // Set projection
        chart.projection = new am4maps.projections.Miller();

        // Create map polygon series
        var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());

        // Exclude Antartica
        polygonSeries.exclude = ["AQ"];

        // Make map load polygon (like country names) data from GeoJSON
        polygonSeries.useGeodata = true;

        // Configure series
        var polygonTemplate = polygonSeries.mapPolygons.template;
        polygonTemplate.tooltipText = "{name}";
        polygonTemplate.polygon.fillOpacity = 0.6;

        // Create hover state and set alternative fill color
        var hs = polygonTemplate.states.create("hover");
        hs.properties.fill = chart.colors.getIndex(0);

        // Add image series
        var imageSeries = chart.series.push(new am4maps.MapImageSeries());
        imageSeries.mapImages.template.propertyFields.longitude = "longitude";
        imageSeries.mapImages.template.propertyFields.latitude = "latitude";
        imageSeries.mapImages.template.tooltipText = "{title}";
        imageSeries.mapImages.template.propertyFields.url = "url";

        var circle = imageSeries.mapImages.template.createChild(am4core.Circle);
        circle.radius = 3;
        circle.propertyFields.fill = "color";

        var circle2 = imageSeries.mapImages.template.createChild(am4core.Circle);
        circle2.radius = 3;
        circle2.propertyFields.fill = "color";


        circle2.events.on("inited", function (event) {
            animateBullet(event.target);
        })

        function animateBullet(circle) {
            var animation = circle.animate([{property: "scale", from: 1, to: 5}, {
                property: "opacity",
                from: 1,
                to: 0
            }], 1000, am4core.ease.circleOut);
            animation.events.on("animationended", function (event) {
                animateBullet(event.target.object);
            })
        }

        var colorSet = new am4core.ColorSet();
        imageSeries.data = [
            {% if domains %}
                {% for domain, details in domains.items %}
                    {% if details|key:"geolocation" %}
                        {
                            'title': '{{details|key:"geolocation"|key:"country_long"}}/{{details|key:"geolocation"|key:"region"}}',
                            'latitude': {{details|key:"geolocation"|key:"latitude"}},
                            'longitude': {{details|key:"geolocation"|key:"longitude"}},
                            'color': colorSet.next()
                        },
                    {% endif %}
                {% endfor %}
            {% endif %}
        ];
    </script>

{% endblock %}
